const path = require("path")
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
    mode: 'production',
    entry: {
        index:"./src/index.ts",
        about:"./src/about.ts",
    },
    output: {
        filename: "[name].js",
        path: path.resolve(__dirname, "dist"),
        clean: true,
    },
    module: {
        rules: [
            {
                test: /\.ts$/,
                use: "ts-loader",
                exclude: /node_modules/,
            },
            {
                test: /\.css$/,
                use: ["style-loader", "css-loader"],
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            filename: "index.html",
            template: path.resolve(__dirname, "src/public/index.html"),
            chunks: ["index"],
        }),
        new HtmlWebpackPlugin({
            filename: "about.html",
            template: path.resolve(__dirname, "src/public/about.html"),
            chunks: ["about"],
        })
    ],
    resolve: {
        extensions: ['.ts', '.js']
    },
    devServer: {
        static: "./dist",
        port: 8080,
        open: true,
    }

}
//Vite